<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>我的收益</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/yzl.css"/>

</head>
<body>
    <div class="container" id="app" v-cloak>
        <div class="myearnings-top" :class="BSImg">
            <div style="height:60px;">
                <div v-back.tapmode class="back"></div>
            </div>
            <p>可提现收益(元)</p>
            <p>{{infos.balance}}</p>
            <a v-open-win.tapmode vurl="withdraw">提现</a>
        </div>
        <div class="myearnings-middle">
            <div>
                <p>上月收益({{infos.last_month_is_calculated == '1' ? '已结算' : '未结算'}}/元)</p>
                <p>{{infos.last_month_profit}}</p>
            </div>
            <div>
                <p>本月预估收益({{infos.cur_month_is_consume_satisfied == '1' ? '已满足' : '未满足'}}/元)</p>
                <p>{{infos.cur_month_profit}}</p>
            </div>
        </div>
        <div class="row-container">
            <a class="row" v-open-win.tapmode="{keyState:''}" vurl="../ledger/total_income" v-row-active>
                <span>推广收益列表</span>
                <img class="row-arrow" v-src="'../../image/arrow_right_grey.png'">
            </a>
        </div>
    </div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/common.js"></script>
<script src="../../script/url.js"></script>
<script>

    var infos;
    apiready = function () {
        setBSImg();
        showProgress();

        var data = {
            member_id: getPrefs('member_id')
        }
        var callback = function (ret) {
            infos = ret.content;
            initApp();
            api.parseTapmode();
        };
        pinet.post(URL.myProfit, data, callback);

        addListeners();
    };

    function initApp() {
        new Vue({
            el: '#app',
            data:{
                infos:infos,
                BSImg: {
                    big: Vue.BSImg == 'big',
                    small: Vue.BSImg == 'small'
                }
            }
        })
    }

    function addListeners() {
        api.addEventListener({
            name: 'withdraw'
        }, function () {
            window.location.reload();
        });

        api.addEventListener({
            name: 'viewappear'
        }, function () {
            onPageStart();
        });

        api.addEventListener({
            name: 'viewdisappear'
        }, function (ret, err) {
            onPageEnd();
        });

        api.addEventListener({
            name: 'keyback'
        }, function (ret, err) {
            onPageEnd();
            api.closeWin();
        });
    }


</script>
</html>
